package com.tutsplus.flash {
	import camo.core.display.CamoDisplay;

	import flash.text.TextField;

	public class LabelComponent extends CamoDisplay
	{

		protected static const FIRST_WORD:String = "Hello";
		protected var words:Array = new Array("World", "People", "Flash", "Flash Tuts");
		protected var label:TextField;

		public function get totalWords():Number
		{
			return words.length;
		}

		public function LabelComponent()
		{
			super();
			init();
		}

		protected function init():void
		{
			label = createTextField();
			addChild(label);
		}

		protected function createTextField():TextField
		{
			var tempTextField:TextField = new TextField();
				tempTextField.selectable = false;

			return tempTextField;
		}

		public function changeWords(id:Number):void
		{
			label.text = FIRST_WORD + " " + words[id];
		}

	}
}